'use strict';
import getSystemInfo from '../../../utils/getSystemInfo.js';

new Component({
  options: {
    addGlobalClass: true,
  },
  externalClasses: ['lee-class'],
  properties: {
    type: {
      type: String,
      value: '',
    },

    title: {
      type: String,
      value: '',
    },

    loading: {
      type: Boolean,
      value: false,
    },

    color: {
      type: String,
      value: '',
    },

    gradual: {
      type: Boolean,
      value: true,
    },

    homePage: {
      type: String,
      value: '',
    },
  },
  data: {
    SystemInfo: {},
  },

  lifetimes: {
    attached(self) {
      const SystemInfo = getSystemInfo();
      self.setData({ SystemInfo });
    },
  },

  methods: {
    goBack() {
      wx.navigateBack();
    },
    toHome() {
      const url = this.data.homePage;
      if (!url) return ;
      wx.reLaunch({ url });
    },
  }
});
